
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <!--<link href="../css/registro.css" rel="stylesheet" type="text/css"/>-->
        <link rel="stylesheet" type="text/css" href="Style.css" />

        <title>Social Rider</title>
                <script src="http://code.jquery.com/jquery-1.8.1.min.js"></script>
                <script src="http://malsup.github.com/jquery.cycle.all.js"></script>
                <script>
                    $("document").ready(function(){
                        $("#slideshow").cycle()
                    })
                </script>
		<link href="http://fonts.googleapis.com/css?family=Ubuntu+Condensed" rel="stylesheet" type="text/css" />
		<link href="http://fonts.googleapis.com/css?family=Kreon" rel="stylesheet" type="text/css" />
                    <script src="https://maps.google.com/maps?file=api&v=2&key=ABQIAAAAjU0EJWnWPMv7oQ-jjS7dYxTPZYElJSBeBUeMSX5xXgq6lLjHthSAk20WnZ_iuuzhMt60X_ukms-AUg"
            type="text/javascript"></script>

    <script type="text/javascript">
    //<![CDATA[

    var iconBlue = new GIcon(); 
    iconBlue.image = 'http://labs.google.com/ridefinder/images/mm_20_blue.png';
    iconBlue.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iconBlue.iconSize = new GSize(12,20);//GSize(12, 20);
    iconBlue.shadowSize = new GSize(22, 20);
    iconBlue.iconAnchor = new GPoint(6, 20);
    iconBlue.infoWindowAnchor = new GPoint(5, 1);

    var iconRed = new GIcon(); 
    iconRed.image = 'http://labs.google.com/ridefinder/images/mm_20_red.png';
    iconRed.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iconRed.iconSize = new GSize(12, 20);
    iconRed.shadowSize = new GSize(22, 20);
    iconRed.iconAnchor = new GPoint(6, 20);
    iconRed.infoWindowAnchor = new GPoint(5, 1);

    var customIcons = [];
    customIcons["restaurant"] = iconBlue;
    customIcons["bar"] = iconRed;

    function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(-33.042023,-71.591133), 15);
        


//conexión a BD GDownloadUrl("phpsqlajax_genxml.php", function(data) {

        GDownloadUrl("conexionBD.php", function(data) {
          var xml = GXml.parse(data);
          var markers = xml.documentElement.getElementsByTagName("marker");
          for (var i = 0; i < markers.length; i++) {
            var name = markers[i].getAttribute("name");
            var address = markers[i].getAttribute("address");
            var type = markers[i].getAttribute("type");
            var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
                                    parseFloat(markers[i].getAttribute("lng")));
            var marker = createMarker(point, name, address, type);
            map.addOverlay(marker);
          }
        });
      }
    }
    
       // function setDirections(Address) {  
     // gdir.load("from: " + Address + " to: @40.396764, -3.713379",  
     //           { "locale": "es" })

    function createMarker(point, name, address, type) {
      var marker = new GMarker(point, customIcons[type]);
      var html = "<b>" + name + "</b> <br/>" + address;
      GEvent.addListener(marker, 'click', function() {
        marker.openInfoWindowHtml(html);
      });
      return marker;
    }
    //]]>
  </script>
  
    </head>
    <body>
    <div id="map" style="width: 500px; height: 300px"></div>
        <div id="wrapper">
            <div id="header">
                <div id="slideshow">
                    <img src="../images/social1.png" alt="Image 1">                
                    <img src="../images/social2.png" alt="Image 2">
                    <img src="../images/social3.png" alt="Image 3">
                    <img src="../images/social4.png" alt="Image 4">
                    <img src="../images/social5.png" alt="Image 5">
                </div>
                <div id="pro6">
                    <ul>
                    <li class="current"><a href="login.php"><b>Principal</b></a></li>
                    <li>&nbsp &nbsp &nbsp &nbsp</li>
                    <li><a href="registro.php"><b>Registrate</b></a></li>
                    <li>&nbsp &nbsp &nbsp &nbsp</li>
                    <li><a href="mirider,php"><b>mi perfil</b></a></li>
                    <li>&nbsp &nbsp &nbsp &nbsp</li>
                    <li><a href="#"><b>Quienes somos</b></a></li>
                    <li>&nbsp &nbsp &nbsp &nbsp</li>
                    <li><a href="http://www.google.cl"><b>Buscar</b></a></li>
                    </ul>
                </div>
            </div>
            <div id="page" align="center">
                <img src="img/SRLogo2.png"><br>
                
                <?php

                require '../funciones/funciones.php';
                include_once '../clases/Usuario.php';

                $user="rope";//$_SESSION['usuario'];
                $pass="rope";//$_SESSION['clave'];

                verificarUsuario($user, $pass);
                $usuario= new Usuario;
                $usuario->setUsuario($user);

                obtenerRider($usuario);

                $viajes=$_GET['mostrarviajes'];

                ?>
                <br><img src="img/Male_user.png" width="130" height="130"><br>
                <table >
                    <h3>Mi Perfil</h3>
                    <thead>
                        <tr>
                            <td></td>
                            <th scope='col'>Nombre</th>
                            <th scope='col'>Email</th>
                            <th scope='col'>Pais</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <?echo"
                                <th scope='row'></th>
                                <td>$usuario->nombre</td>
                                <td>$usuario->correo</td>
                                <td>$usuario->pais</td>";
                            ?>
                        </tr>
                    </tbody>
                </table>
                    <?
                        $viajes=obtenerViajes($usuario);
                        $tamano=  sizeof($viajes);
                        //echo "el tamano es: $tamano ";
                    ?>
                <br>
                <br>
                <table  border='1'>
                    <h3>Mis Viajes</h3>
                        <thead>
                            <tr>
                                <td></td>
                                <th scope='col'>Fecha</th>
                                <th scope='col'>Distancia Recorrida</th>
                                <th scope='col'>Duración</th>
                                <th scope='col'>Pendiente</th>
                                <th scope='col'>Velocidad Promedio</th>
                                <th scope='col'>Velocidad Maxima</th>
                                <th scope='col'>Calorías Consumidas</th>
                            </tr>
                        </thead>
                        
                        <tbody>
                            <?  for($i=0;$i<$tamano;$i++){
                                
                                echo"<tr>
                                <th scope='row'></th>
                                <td>".$viajes[$i]->hora_inicio."</td>
                                <td>".$viajes[$i]->distancia_recorrida."</td>
                                <td>".$viajes[$i]->tiempo."</td>
                                <td>".$viajes[$i]->pendiente."</td>
                                <td>".$viajes[$i]->velocidad_prom."</td>
                                <td>".$viajes[$i]->velocidad_max."</td>
                                <td>".$viajes[$i]->calorias."</td>
                                </tr> ";
                                }?>
                        </tbody>
                    </table>
                <div class="grafico">
                   <a href="mirider.php?mostrargraficos=si">Mostrar Graficos</a>
                   <a href="GoogleMap.php">Mostrar Recorrido</a>
                   <br>

                   <?
                   
                   
                   if($_GET['mostrargraficos']==si){
                       if($_GET['grafico']==distancia)
                       echo "<a href='mirider.php?mostrargraficos=si&grafico=cual'></a>";
                       if($_GET['grafico']=="cual"){
                           echo "<a href='mirider.php?mostrargraficos=si&grafico=distancia'>Distancia</a>";
                           echo "<a href='mirider.php?mostrargraficos=si&grafico=vel'>Calorias</a>";
                           echo "<a href='mirider.php?mostrargraficos=si&grafico=distancia'>Velocidad Promedio</a>";
                           echo "<a href='mirider.php?mostrargraficos=si&grafico=distancia'>Volocidad Max</a>";
                       }
                       
                       echo "<img src='img/distancia.jpg' width='600' height='300'><br>";
                   }
                   ?>
            </div>
            </div>
           

            
            
            <div id="footer">
			&copy; Multimedios 1 Semestre 2012 | <a href="#">Felipe Sepúlveda</a> <a href="#">Rodrigo Urbina</a>
            </div>
        </div>
    </body>
</html>
